@echo off
gcc -nostdlib -nostdinc -fno-builtin -e efi_main -Wl,--subsystem,10 -o main.efi src/yctalib/*.c src/efipart/*.c -I src/yctalib -I src -I src/efipart

x86_64-elf-gcc -fno-builtin -nostdlib -nostdinc src/main.c -c -o main.o
x86_64-elf-gcc -fno-builtin -nostdlib -nostdinc src/std.c -c -o std.o
x86_64-elf-gcc -fno-builtin -nostdlib -nostdinc src/graphic.c -c -o graphic.o
x86_64-elf-gcc -fno-builtin -nostdlib -nostdinc src/console.c -c -o console.o
x86_64-elf-gcc -fno-builtin -nostdlib -nostdinc src/memory.c -c -o memory.o
x86_64-elf-ld -e ew_wanderer_main -z norelro -Ttext-segment 0x100000 --static -o system.elf main.o std.o graphic.o console.o memory.o

copy main.efi esp\EFI\BOOT\BOOTX64.EFI
copy system.elf esp\kernel.elf
qemu-system-x86_64 -bios OVMF.fd -drive file=fat:rw:esp,format=vvfat,index=0 -net none